<!DOCTYPE html>
<html lang="zh_CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="description" content="前端单词大挑战">
  <meta name="keywords" content="单词, 前端, 单词大挑战">
  <meta name="author" content="熙韩">

  <title>前端单词大挑战</title>
  <link rel="stylesheet" href="./css/reset.css">
  <link rel="icon" href="cuo.ico" type="image/x-icon">
  <style>
    html,
    body {
      margin: 0;
      padding: 0;
      height: 100%;
      min-width: 100vh;
      user-select: none;
    }

    body {
      background-image: url('./images/05-DkNYuAPT.jpg');
      background-repeat: no-repeat;
      background-position: center center;
      background-size: cover;
      background-attachment: fixed;
    }

    .container {
      width: 100%;
      height: 100%;
      position: relative;
    }

    .box {
      display: none;
      width: 500px;
      height: 700px;
      border-radius: 50px;
      box-shadow: #BBCFFF 0 0 10px;
      background-color: rgba(0, 0, 0, 0.2);
      /* background-color: #FBF4F9; */
      margin: 20px auto;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background-image: url(./images/cuo.jpg.jpg);
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
    }

    /* 隐藏滚动条 */
    ::-webkit-scrollbar {
      display: none;
    }

    /* 标题样式 */
    .box-title {
      text-align: center;
      font-size: 20px;
      font-weight: bold;
      margin-top: 20px;
    }

    .box-title h1 {
      color: #fff;
      font-size: 30px;
      font-weight: bold;
      margin-top: 20px;
    }

    /* 用户名输入界面 */
    .uname {
      display: block;
      position: absolute;
      width: 500px;
      height: 300px;
      background-color: skyblue;
      background-image: url(./images/01-DUBKBkjT.jpg);
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      margin: 50px auto;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      border-radius: 50px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
      top: 45%;
    }

    .title {
      text-align: center;
      font-size: 20px;
      font-weight: bold;
      margin-top: 20px;
    }

    .title h1 {
      color: #E1F2FB;
      font-size: 30px;
      font-weight: bold;
      margin-top: 20px;
    }

    .input {
      text-align: center;
      margin-top: 50px;
    }

    .input input {
      width: 200px;
      height: 30px;
      border-radius: 10px;
      border: 1px solid #ccc;
      padding-left: 10px;
    }

    .btn {
      text-align: center;
      margin-top: 50px;
    }

    .btn button {
      width: 100px;
      height: 30px;
      border-radius: 10px;
      border: 1px solid #ccc;
      background-color: #FAAFFF;
      color: #fff;
    }

    .btn button:hover {
      background-color: #BBCFFF;
    }

    /* 清除input点击边框 */
    input:focus {
      outline: none;
    }

    /* 信息栏样式 */
    .box-body {
      display: flex;
      font-size: 16px;
      margin-top: 20px;
    }

    #username {
      width: 200px;
      height: 50px;
      border-radius: 10px;
      /* background-color: #ccc; */
      padding-left: 10px;
      display: flex;
      align-items: center;
      text-align: center;
      line-height: 50px;
    }

    #username h1 {
      color: #DB3056;
      border-radius: 10px;
      font-size: 16px;
    }

    #username h1 span {
      color: #fff;
    }

    #time {
      width: 200px;
      height: 50px;
      border-radius: 10px;
      line-height: 50px;
      /* background-color: #ccc; */
      padding-left: 10px;
    }

    #time h1 {
      font-size: 16px;
      color: #DB3056;
    }

    #time h1 span {
      color: #fff;
      font-size: 20px;
    }

    #score {
      width: 200px;
      height: 50px;
      border-radius: 10px;
      line-height: 50px;
      /* background-color: #ccc; */
      padding-left: 10px;
    }

    #score h1 {
      font-size: 16px;
      color: #DB3056;
    }

    #score h1 span {
      color: #fff;
      font-size: 20px;
    }

    /* 内容区域样式 */
    .content {
      width: 500px;
      height: 400px;
      margin-top: 20px;
    }

    /* 三种题型共用样式 */
    .question-types {
      width: 400px;
      margin: 20px auto;
      padding: 20px;
      /* background-color: #f0f8ff; */
      border-radius: 10px;
    }

    .question-text {
      font-size: 18px;
      margin-bottom: 20px;
      line-height: 1.5;
      color: #000;
    }

    /* 选择题样式 */
    .choice-question {
      display: none;
    }

    .options {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .option {
      padding: 10px;
      background-color: #e6f7ff;
      border: 1px solid #91d5ff;
      border-radius: 5px;
      cursor: pointer;
      transition: all 0.3s;
    }

    .option:hover {
      background-color: #bae7ff;
    }

    .option.selected {
      background-color: #91d5ff;
      border-color: #1890ff;
    }

    /* 填空题样式 */
    .fill-question {
      display: none;
    }

    .fill-input {
      width: 100%;
      padding: 10px;
      font-size: 16px;
      border: 1px solid #ccc;
      border-radius: 5px;
      margin-top: 10px;
      color: red;
    }

    /* 补全题样式 */
    .complete-question {
      display: none;
    }

    .complete-inputs {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 10px;
    }

    .complete-input {
      width: 80px;
      padding: 8px;
      text-align: center;
      border: 1px solid #ccc;
      border-radius: 5px;
      color: red;
    }

    /* 提交按钮样式 */
    .submit-btn {
      text-align: center;
      margin-top: 20px;
    }

    .submit-btn button {
      padding: 8px 20px;
      background-color: #faafff;
      color: white;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      font-size: 16px;
      transition: all 0.3s;
    }

    .submit-btn button:hover {
      background-color: #f787ff;
    }

    .submit-btn-fill {
      text-align: center;
      margin-top: 20px;
    }

    .submit-btn-fill button {
      padding: 8px 20px;
      background-color: #faafff;
      color: white;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      font-size: 16px;
      transition: all 0.3s;
    }

    .submit-btn-fill button:hover {
      background-color: #f787ff;
    }

    .submit-btn-complete {
      text-align: center;
      margin-top: 20px;
    }

    .submit-btn-complete button {
      padding: 8px 20px;
      background-color: #faafff;
      color: white;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      font-size: 16px;
      transition: all 0.3s;
    }

    .submit-btn-complete button:hover {
      background-color: #f787ff;
    }

    /* 游戏说明页面 */
    .game-guide {
      display: none;
      position: absolute;
      top: 45%;
      left: 50%;

      transform: translate(-50%, -50%);
      width: 500px;
      height: 700px;
      background-color: #E4F9FF;
      border-radius: 20px;
      box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
      padding: 30px;
    }

    .guide-title {
      text-align: center;
      margin-bottom: 30px;
    }

    .guide-title h1 {
      color: red;
      font-size: 28px;
    }

    .guide-content {
      height: 400px;
      overflow-y: auto;
      padding: 0 20px;
    }

    .guide-content ul {
      font-size: 16px;
      line-height: 2;
      padding-left: 20px;
    }

    .guide-btn {
      text-align: center;
      margin-top: 30px;
    }

    #start-game {
      width: 150px;
      height: 40px;
      border-radius: 10px;
      border: none;
      background-color: #FAAFFF;
      color: white;
      font-size: 16px;
      cursor: pointer;
    }

    #start-game:hover {
      background-color: #BBCFFF;
    }

    /* 结算和排行榜页面 */
    .result-board {
      display: none;
      position: absolute;
      top: 45%;
      left: 50%;
      transform: translate(-50%, -50%);
      background-image: url(./images/cuo.jpg.jpg);
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      width: 500px;
      height: 700px;
      background-color: transparent;
      border-radius: 20px;
      box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
      padding: 20px;
    }

    .result-title {
      text-align: center;
      margin-bottom: 30px;
    }

    .result-title h1 {
      color: red;
      font-size: 28px;
    }

    .result-info {
      text-align: center;
      margin-bottom: 40px;
    }

    .result-info p {
      font-size: 20px;
      margin: 15px 0;
    }

    #result-username {
      font-weight: bold;
    }

    #result-score {
      font-weight: bold;
      color: #FF6B6B;
    }

    #result-streak {
      font-weight: bold;
      color: #4ECDC4;
    }

    .ranking-title {
      text-align: center;
      margin: 20px 0;
    }

    .ranking-title h2 {
      color: #000;
      font-size: 24px;
    }

    .ranking-list {
      height: 250px;
      overflow-y: auto;
      margin: 0 20px;
    }

    #rank-list {
      list-style: none;
      padding: 0;
    }

    .result-buttons {
      display: flex;
      justify-content: center;
      gap: 20px;
      margin-top: 30px;
    }

    #restart-btn,
    #close-rank-btn {
      width: 120px;
      height: 40px;
      border-radius: 10px;
      border: none;
      color: white;
      font-size: 16px;
      cursor: pointer;
    }

    #restart-btn {
      background-color: #FAAFFF;
    }

    #restart-btn:hover {
      background-color: #ed80f4;
    }

    #close-rank-btn {
      background-color: #BBCFFF;
    }

    #close-rank-btn:hover {
      background-color: #a9c2ff;
    }

    /* 排行榜项样式 */
    .rank-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 15px;
      margin-bottom: 10px;
      background-color: #f0f8ff;
      border-radius: 8px;
    }

    .rank-number {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background-color: #FFD166;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: bold;
    }

    .rank-username {
      flex: 1;
      margin: 0 15px;
      font-size: 16px;
    }

    .rank-score {
      font-weight: bold;
      color: #E63946;
    }

    /* 前三名特殊样式 */
    .rank-item.top-1 .rank-number {
      background-color: #FFD700;
    }

    .rank-item.top-2 .rank-number {
      background-color: #C0C0C0;
    }

    .rank-item.top-3 .rank-number {
      background-color: #CD7F32;
    }

    /* 滚动条样式 */
    .ranking-list::-webkit-scrollbar {
      width: 6px;
    }

    .ranking-list::-webkit-scrollbar-thumb {
      background-color: #ccc;
      border-radius: 3px;
    }

    /* 错题回顾页面 */
    .wrong-questions {
      display: none;
      position: absolute;
      top: 45%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 500px;
      height: 700px;
      background-image: url(./images/cuo.jpg.jpg);
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      /* background-color: #E4F9FF; */
      border-radius: 20px;
      box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
      padding: 30px;
    }

    .wrong-title {
      text-align: center;
      margin-bottom: 30px;
    }

    .wrong-title h1 {
      color: red;
      font-size: 28px;
    }

    .wrong-list {
      height: 400px;
      overflow-y: auto;
      padding: 0 20px;
    }

    /* 错题项样式 */
    .wrong-item {
      margin-bottom: 20px;
      padding-bottom: 20px;
      border-bottom: 1px dashed #ccc;
      color: coral;
    }

    .wrong-item p {
      margin: 5px 0;
    }

    .wrong-item p:first-child {
      font-weight: bold;
      margin: 10px 0;
    }

    .wrong-item p:last-child {
      color: green;
    }

    .wrong-btn {
      text-align: center;
      margin-top: 20px;
      display: flex;
      justify-content: space-evenly;
    }

    #return {
      width: 120px;
      height: 40px;
      border-radius: 10px;
      border: none;
      background-color: #BBCFFF;
      color: white;
      font-size: 16px;
      cursor: pointer;
    }

    #return:hover {
      background-color: #a9c2ff;
    }

    #back-to-result {
      width: 120px;
      height: 40px;
      border-radius: 10px;
      border: none;
      background-color: #BBCFFF;
      color: white;
      font-size: 16px;
      cursor: pointer;
    }

    #back-to-result:hover {
      background-color: #a9c2ff;
    }

    #username-input {
      color: tomato;
      width: 200px;
      height: 30px;
      border-radius: 10px;
      border: 1px solid #ccc;
      padding-left: 10px;
    }

    .music-toggle {
      position: fixed;
      right: 20px;
      top: 50%;
      transform: translateY(-50%);


      width: 50px;
      height: 50px;
      border-radius: 50%;

      background-color: rgba(250, 175, 255, 0.8);

      color: white;
      font-size: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;

      box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);

      transition: all 0.3s;

      z-index: 9999;

    }

    /* 鼠标悬浮效果 */
    .music-toggle:hover {
      background-color: rgba(187, 207, 255, 0.9);
      /* 与按钮hover同色 */
      transform: translateY(-50%) scale(1.1);
      /* 轻微放大 */
    }


    .music-toggle.playing #musicIcon {
      content: "⏸️";

    }

    .game-introduce {
      position: fixed;
      top: 10px;
      right: 0;
      transform: translateX(-50%);
      color: #fff;
      font-size: 20px;
      cursor: pointer;
      z-index: 9999;
    }
  </style>
</head>

<body>
  <audio id="bgMusic" src="./music/菲菲公主（陆绮菲） - 第57次取消发送.mp3" loop preload="auto" style="display: none;" volumn="0.2">
  </audio>
  <div class="game-introduce">游戏制作思路</div>
  <!-- 容器 -->
  <div class="container">
    <!-- 音乐开关按钮（固定在右侧） -->
    <div class="music-toggle">

      <span id="musicIcon">▶️</span>
    </div>
    <!-- 游戏说明页面 -->
    <div class="game-guide">
      <div class="guide-title">
        <h1>游戏规则说明</h1>
      </div>
      <div class="guide-content">
        <ul>
          <li>(1)游戏包含3种题型:选择题(10道)、填空题(10道)、补全题(10道)</li>
          <li>(2)每道题有30秒倒计时,超时未作答自动判错并进入下一题</li>
          <li>(3)计分规则:基础分3分/题,连续答对3道及以上每道得5分</li>
          <li>(4)选择题需从4个选项中选择正确答案,填空题直接输入单词,补全题需填写单词缺失部分</li>
          <li>(5)全部题目完成后可查看得分、连续答对次数及错题回顾</li>
        </ul>
      </div>
      <div class="guide-btn">
        <button id="start-game">开始挑战</button>
      </div>
    </div>
    <!-- 游戏页面 -->
    <div class="box">
      <div class="box-title">
        <h1>欢迎来到前端单词大挑战</h1>
      </div>
      <div class="box-body">
        <!-- 显示用户名 -->
        <div id="username">
          <h1>用户名：<span id="input-username">熙韩</span></h1>
        </div>
        <!-- 显示剩余时间 -->
        <div id="time">
          <h1>剩余时间: <span id="timeRemaining">30</span> 秒</h1>
        </div>
        <!-- 显示分数 -->
        <div id="score">
          <h1>当前分数: <span id="scoreNum">0</span> 分</h1>
        </div>
      </div>
      <div class="content">
        <div class="question-types">
          <!-- 选择题容器 -->
          <div class="choice-question">
            <div class="question-text choiseText"></div>
            <div class="options">
              <div class="option optA"></div>
              <div class="option optB"></div>
              <div class="option optC"></div>
              <div class="option optD"></div>
            </div>
          </div>

          <!-- 填空题容器 -->
          <div class="fill-question">
            <div class="question-text fillText"></div>
            <input type="text" class="fill-input" placeholder="请输入答案">
            <div class="submit-btn-fill">
              <button>提交答案</button>
            </div>
          </div>

          <!-- 补全题容器 -->
          <div class="complete-question">
            <div class="question-text completeText"></div>
            <div class="complete-inputs">
              <!-- 动态生成补全输入框 -->
              <div class="submit-btn-complete">
                <button>提交答案</button>
              </div>
            </div>
          </div>

          <!-- 提交答案按钮 -->
          <div class="submit-btn">
            <button>提交答案</button>
          </div>
        </div>
      </div>

    </div>

    <!-- 输入用户名界面 -->
    <div class="uname">
      <div class="title">
        <h1>欢迎来到前端单词大挑战</h1>
        <h1>请输入用户名</h1>
      </div>
      <div class="input">
        <input type="text" placeholder="请输入用户名" id="username-input">
      </div>
      <div class="btn">
        <button id="start">开始游戏</button>
      </div>
    </div>
    <!-- 游戏结算和排行榜界面 -->
    <div class="result-board">
      <div class="result-title">
        <h1>游戏结束</h1>
      </div>
      <div class="result-info">
        <p>用户名: <span id="result-username"></span></p>
        <p>最终得分: <span id="result-score"></span></p>
        <p>连续答对: <span id="result-streak"></span></p>
      </div>
      <div class="ranking-title">
        <h2>排行榜</h2>
      </div>
      <div class="ranking-list">
        <ul id="rank-list">
          <!-- 排行榜内容将通过JS动态生成 -->
        </ul>
      </div>
      <div class="result-buttons">
        <button id="restart-btn">错题回顾</button>


      </div>
    </div>

    <!-- 错题回顾页面 -->
    <div class="wrong-questions">
      <div class="wrong-title">
        <h1>错题回顾</h1>
      </div>
      <div class="wrong-list">
        <!-- 错题内容将通过JS动态生成 -->
      </div>
      <div class="wrong-btn">
        <button id="back-to-result">返回结果</button>
        <button id="return">重新开始</button>
      </div>
    </div>
  </div>


  <script src="./js/main.js"></script>
  <script src="./js/index.js"></script>
  <script>
    const gameIntroduce = document.querySelector('.game-introduce');
    gameIntroduce.addEventListener('click', () => {
      window.location.href = './游戏思路介绍.html';
    });
    const returnBtn = document.querySelector('#return');
    returnBtn.addEventListener('click', () => {
      location.reload();
    })
  </script>
</body>

</html>